<?php
require("../SocialAPI/Twitter/twitteroauth.php");  
session_start();  
// The TwitterOAuth instance
$twitteroauth = new TwitterOAuth('VgguNUW6GCggrDOML51w', 'y3G9Gjqu3SUzjW0RWBa1hCT566wSxlslSG9kJwQGJw');
// Requesting authentication tokens, the parameter is the URL we will be redirected to
$request_token = $twitteroauth->getRequestToken('http://indiabigsale.com/123/Medical/Account/twitter_oauth.php');

// Saving them into the session
$_SESSION['oauth_token'] = $request_token['oauth_token'];
$_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
//echo $request_token['oauth_token']."<br/>";
//echo $request_token['oauth_token_secret']."<br/>";
//echo 'Status Code is '. $twitteroauth->http_code;
// If everything goes well..
if($twitteroauth->http_code==200){
    // Let's generate the URL and redirect
    $url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
    header('Location: '. $url);
} else {
	 echo "Error";
}


?>